home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Jan. 1997
- // Author: DSW
- //
- // Description:
- // setProject is used to set the current project.
- //
- // Input Arguments:
- // A string. If empty, the project browser comes up for the
- // new project. Otherwise the project is set to the given
- // string.
- //
- // Return Value:
- // None
- //
- //<doc>
- //<name setProject>
- //<owner "Alias|Wavefront Unsupported">
- //
- //<synopsis>
- // setproject $newProject
- //
- //<returns>
- // none
- //
- //<description>
- // Sets the current project. If no string is specified, the
- // Project Browser window will open.
- //
- //
- //<examples>
- // setProject "C:/Documents and Settings/kilroy/My Documents/maya/projects/default";
- //
- //</doc>
-
- global proc int sp_setLocalWorkspaceCallback (string $path, string $type)
- //
- // Description:
- // Open the selected workspace and make it the new local workspace.
- //
- {
- int $result;
- string $workspace = `workspace -q -fn`;
-
- string $typeList[] = `file -q -typ $path`;
- if (size($typeList) > 0 && $typeList[0] == "directory") {
- workspace -o $path;
-
- // If the browser is up then we must reset it.
- //
-
- if (`window -ex projectViewerWindow`) {
- pv_resetWorkspace; // Force the layout to be redone.
- }
-
- np_resetBrowserPrefs;
-
- $result = true;
- } else {
- confirmDialog -m ($path+" is not a directory.")
- -b "OK" -db "OK" -parent projectViewerWindow;
- $result = false;
- }
-
- // They picked a new one:
- if ( true == $result && $path != $workspace )
- {
- addRecentProject( $path );
- // We also want to update the edit box if they're editing the 'current'
- // (the new one should now be the 'current')
- if ( `window -ex newProjectWindow` )
- {
- string $title = `window -q -t newProjectWindow`;
- // If the use is editing the project, then we want to
- // refresh the Edit window ("2" is edit mode for projectSetup)
- // If they were setting up a new one we close the newProjectWindow
- if ( $title == "Edit Project" )
- projectSetup( 2 );
- else
- deleteUI newProjectWindow;
- // We remove the window if they were setting a new one
- }
- }
-
-
- return $result;
- }
-
- global proc setProject ( string $newProject )
- //
- // Description:
- // Set the current workspace to the one selected by the user.
- //
- {
- // No name given - browse for it
- if ( size( $newProject ) == 0 )
- {
- // Set the directory to the users project area.
- //
- string $wsDir = dirname( `workspace -q -fn` );
-
- if (`file -q -ex $wsDir`) {
- workspace -dir $wsDir;
- }
-
- fileBrowser "sp_setLocalWorkspaceCallback" "Set Project" "" 4;
- }
- // Try to set it directly from the name given
- else
- {
- sp_setLocalWorkspaceCallback $newProject "directory";
- }
- }
-